<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/inc/css.inc"%>
<%@ taglib uri= "http://java.sun.com/jsp/jstl/fmt" prefix= "fmt" %> 
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>课程表</title>
		<link rel="stylesheet" href="${css}/amazeui.css" />
		<link rel="stylesheet" href="${css}/classroomlist.css" />
		<script src="${js}/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="${js}/amazeui.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<script type="text/javascript">
		$(function(){
			var cookieVal = localStorage.patientid;  //获取 local storage 
			if( typeof (cookieVal)  ==  "undefined" || cookieVal ==  undefined){
				window.location.href = "<%=basePath%>web/enrollment/joyin/letter.jsp?a=slectCourseList";
			}else{
				$("#logindiv").show();
			}
		});
	</script>
	<body id="logindiv" style="display:none">
		<div class="box">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd cardtitle">课程列表</div>
				<c:forEach items="${syllabusList}" var="s">
			    	<div class="item">
			    	<div class="itemdate"><fmt:formatDate value="${s.auditoriumStartTime}" type="both" pattern="yyyy-MM-dd HH:mm"/></div>
			    	<div class="itemtitle">${s.syllabusName}</div> 
			    	<div class="itemname">${s.doctorName}</div>
			    	<div class="itemname modelwarp"><div class="modelcont">${s.hospital}<span></span></div></div>
			    	<div class="itembtn">
			    		<c:if test="${s.type == 1}">		    		
			    			<img class="noyuebtn" src="${img}/btn3.png">			    		
			    		</c:if>
			    		<c:if test="${empty s.type}">		    		
			    			<img class="btn1 yuebtn" src="${img}/btn1.png">			    		
			    		</c:if>		    		
			    		<input class="yuetype" type="hidden" value="${s.id}" />
			    	</div>
			    	<div class="itempdf addbtn">
			    		<img src="${img}/btn2.png"/>
			    	</div>
			    </div>
				</c:forEach>
			</div>
		</div>
		<div class="dialog">
			<div class="dialogwin">
				您已预约该课程
			</div>
		</div>
		<script src="${js}/model.js"></script>
		<script>
			$(".yuebtn").click(function(){
				var syllabusId=$(this).next().val();
				var patientId = localStorage.patientid;
				$(this).attr("src","${img}/btn3.png").css({width:41+'px',height:23+'px'});
				$(this).addClass('noyuebtn');
				$(this).removeClass('yuebtn');			
				$.ajax({
					type:"post",
					url:"<%=basePath%>addBespoke.action",
	   				async:false,
	   				data:{syllabusId:syllabusId, patientId:patientId},
	   				success: function(){
	   					
	   				}
				});
				sub(syllabusId)
			})
			
			
			function sub(k){
				$(".dialog").fadeIn(300)
				setTimeout('dialoghidden()',1500)
			}
			function dialoghidden(){
				$(".dialog").fadeOut(300);
			}
			$(".addbtn").click(function(){
				var ind=$(".addbtn").index(this);
				$(".modelwarp").eq(ind).fadeIn(200)
			})
			
			
		</script>
	</body>
</html>
